const url="https://m.douban.com/rexxar/api/v2/"
//标签：tags?count=8
//短评：count=5&start=1
const count=5
Page({
    data:{
        start:0,
        type:'',
        id:''
    },
    onLoad(e){
        console.log(e)
        let {type,id}=e
        wx.request({//详情
          url: url+e.type+'/'+e.id,
          success:res=>{
              console.log('详情')
              console.log(res)
              let mygenres=res.data.genres.join('/')
              let myactors=res.data.actors.slice(0,3).map(v=>{
                  return v.name
              }).join('/')
              this.setData({
                  xq:res.data,
                  mygenres,
                  myactors,
                  type,id
              })
          }
        })
        wx.request({//标签
            url:url+e.type+'/'+e.id+'/tags?count=8',
            success:res=>{
              console.log('tag')
                console.log(res)
                this.setData({
                    bq:res.data
                })
            }
        })
        wx.request({//短评
          url: url+e.type+'/'+e.id+'/interests?count=5',
          success:res=>{
            console.log('短评')
              console.log(res)
              this.setData({
                  dp:res.data
              })
          }
        })
    },
    onReachBottom(){
        this.setData({
            start:this.data.start+count
        })
        // let url=
        // console.log(url)
        wx.request({
          url:url+this.data.type+'/'+this.data.id+'/interests?start='+this.data.start+'&count='+count,
          success:res=>{
              console.log(res)
              let dp=this.data.dp
              let ttt=dp.interests
              let sss=res.data.interests
              ttt=ttt.concat(sss)
              dp.interests=ttt
              this.setData({
                  dp
              })
          }
        })
    }
})